<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@include file="/include/public.jspf"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css"
	href="${path }/css/default/m-base.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/css/default/m-common.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/css/default/p-all.css" />
<script type="text/javascript" src="${path }/js/jquery1.10.2.min.js"></script>

<title>魔环金融</title>
</head>
<body>
	<div class="ui_title">
		<a class="ui_back" href="javascript:void(0)"
			onclick="window.history.back();"><i class="ui_icon_back"></i>返回</a>
		投资详情
	</div>
	<div class="m-main">
		<div class="p_deal">
			<div class="inv-main">
				<div class="inv-header">
					<div class="invh-title">${borrowInfo.borrowName}</div>
					<div class="f15">
						<p>
							${borrowInfo.borrowDuration}<em><c:if test="${borrowInfo.durType eq 'DAY'}">天</c:if>
															<c:if test="${borrowInfo.durType eq 'MONTH'}">个月</c:if></em> /
							年化${borrowInfo.borrowRate}% / ${borrowInfo.repaymentType.text }
						</p>
						<p>可投：${borrowInfo.borrowMoney / 100 - borrowInfo.raiseMoney / 100}元</p>
					</div>
				</div>
				<div class="ui-deal-btn">
					<%-- <a href="${path }/borrowInfo/invest.htm?borrowId=${borrowInfo.id}" class="ui_btn_red">投资</a> --%>
					<c:choose>
						<c:when test="${borrowInfo.status eq 'RAISE'}">
							<a href="${path }/borrowInfo/invest.htm?borrowId=${borrowInfo.id}" class="ui_btn_red">投资</a>
						</c:when>
						<c:when
									test="${borrowInfo.status eq 'REPAYMENTED'}">
									<a href="javascript:;" class="ui_btn_gray">已还清</a>
								</c:when>
								<c:when
									test="${borrowInfo.status eq 'REPAYMENTING'}">
									<a href="javascript:;" class="ui_btn_gray">还款中</a>
								</c:when>
								<c:when
									test="${borrowInfo.status eq 'LOANING'}">
									<a href="javascript:;" class="ui_btn_gray">放款中</a>
								</c:when>
								<c:when
									test="${borrowInfo.status eq 'END' and (borrowInfo.borrowMoney-borrowInfo.raiseMoney)<=0}">
									<a href="javascript:;" class="ui_btn_gray">满标</a>
								</c:when>
						<c:otherwise>
							<a href="javascript:;" class="ui_btn_gray">筹款结束</a>
						</c:otherwise>
					</c:choose>
				</div>
				<div class="inv-center">
				<input type="hidden" name="borrowDuration" id="borrowDuration" value="${borrowInfo.borrowDuration}" />
                    <input type="hidden" name="borrowRate" id="borrowRate" value="${borrowInfo.borrowRate}" />
                    <input type="hidden" name="durType" id="durType" value="${borrowInfo.durType}" />
                    <input type="hidden" name="rewardRate" id="rewardRate" value="${borrowInfo.rewardRate}" />
					<h2>
						收益简述：<span class="red_v1 income">29.17</span>元 / 万元
					</h2>
				</div>
				<div class="inv-footer">
					<div class="invf_tab">
						<ul class="ui_tab_nav ui_tab_num3">
							<li class="select"><span>融资方信息<em></em></span></li>
							<li><span>保障方式<em></em></span></li>
							<li><span>投资记录<em></em></span></li>
						</ul>
						<div class="invf_write"></div>
					</div>
					<div class="invf_cont">
						<div id="tb0" class="ui_con_danbao">
							<table>
								<colgroup>
									<col width="25%" />
									<col width="75%" />
								</colgroup>
								<tbody>
									<tr>
										<th>简介：</th>
										<td class="tb_line"></td>
									</tr>
									<tr>
										<td class="tb_line" colspan="2"
											style="word-break: break-word !important">
											<p style="text-align: center;">
												<img src="${path }/images/ewm.jpg" title="二维码图片.jpg" />
											</p>
											<p>
												<strong>产品介绍</strong>
											</p>
											<!-- <p>“长兴1号370循环贷”是网信理财网络平台推出的投融资服务产品。该产品为企业经营提供流动性补充资金。由联合创业担保集团提供担保，借贷双方通过平台签订电子借贷协议，明确双方的债务与债权关系。网信理财网络平台向投资人和融资方提供投融资服务，帮助双方快捷方便地完成投资和借贷。该服务仅向符合中华人民共和国有关法律法规及本公司相关规定的合格投资人和融资方提供。</p>
											<p>
												<span style="color: rgb(255, 0, 0);">“长兴1号370循环贷”借款期限15天，超过8天可提前还款，提前还款无罚息。&nbsp;</span>
											</p>
											<p>
												<span style="color: rgb(255, 0, 0);">优惠码返利计算规则：按照资金的实际使用天数计算。</span>
											</p>
											<p>
												<span style="color: rgb(255, 0, 0);">优惠码返利结算时间：还款后结算，15个工作日内发放至平台账户。</span>
											</p> -->
											<p>${borrowInfo.productDesc}</p>
											<p>
												<strong>投资安全性</strong>
											</p>
											<p>${borrowInfo.dangerDesc}</p>
											<p>
												<strong>融资方描述</strong>
											</p>
											<p>${borrowInfo.borrowerDesc}</p>
											<p>
												<br />
											</p>
										</td>
									</tr>
								</tbody>
							</table>
						</div>

						<div id="tb1" style="display: none;" class="ui_con_danbao">
							<table>
								<colgroup>
									<col width="25%" />
									<col width="75%" />
								</colgroup>
								<tbody>
									<tr>
										<th>保障方式：</th>
										<td>${borrowInfo.guaranteeMethod}</td>
									</tr>
									<tr>
										<th colspan='2'>担保方介绍：</th>
									</tr>
									<tr>
										<td colspan='2'>${borrowInfo.guaranteeDesc}</td>
									</tr>
								</tbody>
							</table>
						</div>

						<div id="tb2" style="display: none;">
							<c:forEach items="${investList}" var="invest">
							<dl class="ui_con_jl clearfix">
								<dt class="gray_v1">
									<p><c:choose>
											<c:when test="${empty invest.mobile}">***</c:when>
											<c:when test="${fn:length(invest.mobile) > 10}">
												<c:out
													value="${fn:substring(invest.mobile, 0, 2)}**" />
													<c:out value="${fn:substring(invest.mobile, 9, 11)}"/>
											</c:when>
											<c:otherwise>
												<c:out value="${invest.mobile}***" />
											</c:otherwise>
										</c:choose>
										<c:choose>
															<c:when test="${empty invest.realName}">***</c:when>
															<c:otherwise>
																<c:out value="（${fn:substring(invest.realName, 0, 1)}" />
																<c:choose>
																<c:when test="${fn:substring(invest.cardNumber,16,17)%2 eq 0}"><c:out value="女士）"/></c:when>
																<c:otherwise><c:out value="先生）"/></c:otherwise>
																</c:choose>
															</c:otherwise>
														</c:choose>
										</p>
									<p><fmt:formatDate value="${invest.investTime}" type="both" pattern="yyyy/MM/dd HH:mm"/></p>
								</dt>
								<dd class="red_v1 f15">${invest.investMoney / 100}元</dd>
							</dl>
							</c:forEach>
						</div>

					</div>
				</div>

			</div>
		</div>
	</div>
	<script>
	function calcMoney(){
        
    }
	
		$(function() {
			$('.inv-footer .ui_tab_nav li').click(function() {
				if ($(this).hasClass('select'))
					return;
				var idx = $(this).index();
				var $con = $('#tb' + idx);
				$(this).addClass('select').siblings().removeClass('select');
				$con.show().siblings().hide();
			});
			
			var money = 10000;
			var borrowrate = parseFloat($("#borrowRate").val()/100);
			var rewardRate = parseFloat($("#rewardRate").val()/100);
			var borrowDuration = parseFloat($("#borrowDuration").val());
			var durType = $("#durType").val();
			var espectMoney = 0;
			if (durType == "MONTH") {
				espectMoney = money * (borrowrate+rewardRate) / 12 * borrowDuration;
			} else if (durType == "DAY") {
				espectMoney = money * (borrowrate+rewardRate) / 365 * borrowDuration;
			}
	        $('.income').html(espectMoney.toFixed(2));
		});
	</script>
</body>
</html>